//vuex
import store from '../store/index.js'
import http from "../utility/request.js";

const baseUrl = process.env.NODE_ENV === 'development' ? 'http://api.relaverse.cn/' : 'http://api.relaverse.cn/'
// const baseUrl = process.env.NODE_ENV === 'development' ? 'http://8.142.162.201/' : 'http://8.142.162.201/'

//获取用户全部地址
export const getAll = (params) => http.post(`/index/shop_address/getAll`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});
//添加收货地址
export const add = (params) => http.post(`/index/shop_address/add`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});
//获取地址详情
export const getById = (params) => http.post(`/index/shop_address/getById`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});

//修改地址详情
export const update = (params) => http.post(`/index/shop_address/update`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});

//设置默认地址
export const top = (params) => http.post(`/index/shop_address/top`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});

//设置默认地址
export const del = (params) => http.post(`/index/shop_address/del`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});

//app入口轮播
export const appShopBanner = (params) => http.post(`/index/shop_index/app_shop_banner`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});

//app入口轮播是否展示
export const shop_open = (params) => http.post(`/index/login/shop_open`, {
	data: {
		acctoken: store.state.collectionToken,
		...params
	},
	baseUrl
});